fix(Makefile): prevent NUM_VALIDATORS from evaluating to two tokens - #339
fix(Makefile): prevent NUM_VALIDATORS from evaluating to two tokens#339Ocheretovich wants to merge 1 commit into
Conversation
This is advisory review only.\n\nI independently re-ran the old and new Makefile expressions against the three relevant manifest states, plus a missing-file control:\n\n| manifest | old expression | this PR |\n|---|---:|---:|\n| missing file | The revised shell conditional treats a positive count as authoritative and falls back only for an empty/zero/non-numeric result.\n\nThe shell syntax is POSIX-compatible ( |
Fixed a bug in NUM_VALIDATORS: when the manifest had no [nodes.validator...] entries, grep -c returned 0 but exited with status 1, which triggered the || echo 5 fallback resulting in the variable evaluating to "0 5" instead of a single number. The check is now explicit: fall back to 5 only when grep's count is missing or zero, otherwise use the actual count.
I tested the old and new logic against three cases missing manifest, manifest with zero validators, and manifest with 3 validators. The first and third cases behave identically either way, but the middle one exposes the bug: the old logic returned "0\n5" (two values instead of one) when the manifest existed but had no validator entries, while the fix correctly returns 5.